package com.personal.service.impl;

import com.personal.dao.ServiceDao;
import com.personal.domain.Servicer;
import com.personal.service.ServiceService;
import com.personal.util.partDisplay.ServicerPart;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * @projectName: smartCommunity_springboot
 * @package: com.personal.service.impl
 * @className: ServiceServiceImpl
 * @author: bong~
 * @description: TODO
 * @date: 2023/8/10 10:23
 * @version: 1.0
 */

@Service
public class ServiceServiceImpl implements ServiceService {


    @Autowired
    private ServiceDao serviceDao;


    @Override
    public List<Servicer> selectAll() {
        return serviceDao.selectAll();
    }

    @Override
    public List<ServicerPart> selectPartAll() {
        return serviceDao.selectPartAll();
    }

    @Override
    public List<ServicerPart> selectPartByKey(String name, String code) {
        return serviceDao.selectPartByKey(name,code);
    }

    @Override
    public boolean add(Servicer service) {
        int flag=serviceDao.add(service);
        if(flag>0)
            return true;
        return false;
    }

    @Override
    public Servicer getUpdateData(int id) {
        return serviceDao.getUpdateData(id);
    }

    @Override
    public boolean update(Servicer service) {
        int flag=serviceDao.update(service);
        if(flag>0)
            return true;
        return false;
    }

    @Override
    public boolean delete(List<Integer> ids) {

        for(int id:ids){
            int flag=serviceDao.delete(id);
            if(flag<0)
                return false;
        }
        return true;
    }
}
